// Author: David Qin
// E-mail: david@hereapp.cn
// Date: 2014-11-05

(function ($) {

    // a case insensitive jQuery :contains selector
    $.expr[":"].searchableSelectContains = $.expr.createPseudo(function (arg) {
        return function (elem) {
            return $(elem).text().toUpperCase().indexOf(arg.toUpperCase()) >= 0;
        };
    });

    $.searchableSelect = function (element, options) {
        this.element = element;
        this.options = options || {};
        this.init();

        var _this = this;

        this.searchableElement.click(function (event) {
            // event.stopPropagation();
            _this.show();
        }).on('keydown', function (event) {
            if (event.which === 13 || event.which === 40 || event.which == 38) {
                event.preventDefault();
                _this.show();
            }
        });

        $(document).on('click', null, function (event) {
            if (_this.searchableElement.has($(event.target)).length === 0)
                _this.hide();
        });

        this.input.on('keydown', function (event) {
            event.stopPropagation();
            if (event.which === 13) {         //enter
                event.preventDefault();
                _this.selectCurrentHoverItem();
                _this.hide();
            } else if (event.which == 27) { //ese
                _this.hide();
            } else if (event.which == 40) { //down
                _this.hoverNextItem();
            } else if (event.which == 38) { //up
                _this.hoverPreviousItem();
            }
        }).on('keyup', function (event) {
            if (event.which != 13 && event.which != 27 && event.which != 38 && event.which != 40)
                _this.filter();
        })
    }

    var $sS = $.searchableSelect;

    $sS.fn = $sS.prototype = {
        version: '0.0.1'
    };

    $sS.fn.extend = $sS.extend = $.extend;

    $sS.fn.extend({
        init: function () {
            var _this = this;
            this.element.hide();

            this.searchableElement = $('<div tabindex="0" class="searchable-select"></div>');
            this.holder = $('<div class="searchable-select-holder"></div>');
            this.dropdown = $('<div class="searchable-select-dropdown searchable-select-hide"></div>');
            this.input = $('<input type="text" class="searchable-select-input" />');
            this.items = $('<div class="searchable-select-items"></div>');
            this.caret = $('<span class="searchable-select-caret"></span>');

            this.scrollPart = $('<div class="searchable-scroll"></div>');
            this.hasPrivious = $('<div class="searchable-has-privious">...</div>');
            this.hasNext = $('<div class="searchable-has-next">...</div>');

            this.hasNext.on('mouseenter', function () {
                _this.hasNextTimer = null;

                var f = function () {
                    var scrollTop = _this.items.scrollTop();
                    _this.items.scrollTop(scrollTop + 20);
                    _this.hasNextTimer = setTimeout(f, 50);
                }

                f();
            }).on('mouseleave', function (event) {
                clearTimeout(_this.hasNextTimer);
            });

            this.hasPrivious.on('mouseenter', function () {
                _this.hasPriviousTimer = null;

                var f = function () {
                    var scrollTop = _this.items.scrollTop();
                    _this.items.scrollTop(scrollTop - 20);
                    _this.hasPriviousTimer = setTimeout(f, 50);
                }

                f();
            }).on('mouseleave', function (event) {
                clearTimeout(_this.hasPriviousTimer);
            });

            this.dropdown.append(this.input);
            this.dropdown.append(this.scrollPart);

            this.scrollPart.append(this.hasPrivious);
            this.scrollPart.append(this.items);
            this.scrollPart.append(this.hasNext);

            this.searchableElement.append(this.caret);
            this.searchableElement.append(this.holder);
            this.searchableElement.append(this.dropdown);
            this.element.after(this.searchableElement);

            this.buildItems();
            this.setPriviousAndNextVisibility();
        },

        filter: function () {
            var text = this.input.val();
            this.items.find('.searchable-select-item').addClass('searchable-select-hide');
            this.items.find('.searchable-select-item:searchableSelectContains(' + text + ')').removeClass('searchable-select-hide');
            if (this.currentSelectedItem.hasClass('searchable-select-hide') && this.items.find('.searchable-select-item:not(.searchable-select-hide)').length > 0) {
                this.hoverFirstNotHideItem();
            }

            this.setPriviousAndNextVisibility();
        },

        hoverFirstNotHideItem: function () {
            this.hoverItem(this.items.find('.searchable-select-item:not(.searchable-select-hide)').first());
        },

        selectCurrentHoverItem: function () {
            if (!this.currentHoverItem.hasClass('searchable-select-hide'))
                this.selectItem(this.currentHoverItem);
        },

        hoverPreviousItem: function () {
            if (!this.hasCurrentHoverItem())
                this.hoverFirstNotHideItem();
            else {
                var prevItem = this.currentHoverItem.prevAll('.searchable-select-item:not(.searchable-select-hide):first')
                if (prevItem.length > 0)
                    this.hoverItem(prevItem);
            }
        },

        hoverNextItem: function () {
            if (!this.hasCurrentHoverItem())
                this.hoverFirstNotHideItem();
            else {
                var nextItem = this.currentHoverItem.nextAll('.searchable-select-item:not(.searchable-select-hide):first')
                if (nextItem.length > 0)
                    this.hoverItem(nextItem);
            }
        },

        buildItems: function () {
            var _this = this;
            this.element.find('option').each(function () {
                var item = $('<div class="searchable-select-item" data-value="' + $(this).attr('value') + '">' + $(this).text() + '</div>');

                if (this.selected) {
                    _this.selectItem(item);
                    _this.hoverItem(item);
                }

                item.on('mouseenter', function () {
                    $(this).addClass('hover');
                }).on('mouseleave', function () {
                    $(this).removeClass('hover');
                }).click(function (event) {
                    event.stopPropagation();
                    _this.selectItem($(this));
                    _this.hide();
                });

                _this.items.append(item);
            });

            this.items.on('scroll', function () {
                _this.setPriviousAndNextVisibility();
            })
        },
        show: function () {
            this.dropdown.removeClass('searchable-select-hide');
            this.input.focus();
            this.status = 'show';
            this.setPriviousAndNextVisibility();
        },

        hide: function () {
            if (!(this.status === 'show'))
                return;

            if (this.items.find(':not(.searchable-select-hide)').length === 0)
                this.input.val('');
            this.dropdown.addClass('searchable-select-hide');
            this.searchableElement.trigger('focus');
            this.status = 'hide';
        },

        hasCurrentSelectedItem: function () {
            return this.currentSelectedItem && this.currentSelectedItem.length > 0;
        },

        selectItem: function (item) {
            if (this.hasCurrentSelectedItem())
                this.currentSelectedItem.removeClass('selected');

            this.currentSelectedItem = item;
            item.addClass('selected');

            this.hoverItem(item);

            this.holder.text(item.text());
            var value = item.data('value');
            this.holder.data('value', value);
            this.element.val(value);

            if (this.options.afterSelectItem) {
                this.options.afterSelectItem.apply(this);
            }
        },

        hasCurrentHoverItem: function () {
            return this.currentHoverItem && this.currentHoverItem.length > 0;
        },

        hoverItem: function (item) {
            if (this.hasCurrentHoverItem())
                this.currentHoverItem.removeClass('hover');

            if (item.outerHeight() + item.position().top > this.items.height())
                this.items.scrollTop(this.items.scrollTop() + item.outerHeight() + item.position().top - this.items.height());
            else if (item.position().top < 0)
                this.items.scrollTop(this.items.scrollTop() + item.position().top);

            this.currentHoverItem = item;
            item.addClass('hover');
        },

        setPriviousAndNextVisibility: function () {
            if (this.items.scrollTop() === 0) {
                this.hasPrivious.addClass('searchable-select-hide');
                this.scrollPart.removeClass('has-privious');
            } else {
                this.hasPrivious.removeClass('searchable-select-hide');
                this.scrollPart.addClass('has-privious');
            }

            if (this.items.scrollTop() + this.items.innerHeight() >= this.items[0].scrollHeight) {
                this.hasNext.addClass('searchable-select-hide');
                this.scrollPart.removeClass('has-next');
            } else {
                this.hasNext.removeClass('searchable-select-hide');
                this.scrollPart.addClass('has-next');
            }
        }
    });

    $.fn.searchableSelect = function (options) {
        this.each(function () {
            var sS = new $sS($(this), options);
        });

        return this;
    };

})(jQuery);


function select_dep_name(this_) {
    var types = document.getElementsByClassName("attendance_tag attendance_active");
    if (types[0].id === 'DepartmentalAttendance'){
        var year_val = document.getElementById("year").value;
        var month_val = document.getElementById("month").value;
        QuerySummary(year_val, month_val, '1');
    }else {
        year_val = document.getElementById("DispatchYear").value;
        month_val = document.getElementById("DispatchMonth").value;
        QuerySummary(year_val, month_val, '2');
    }

}

function QuerySummary(year_val, month_val, types) {
    document.getElementById("loading").style.display = "inline-block";
    var form = new FormData();
    form.append("year_val", year_val);
    form.append("month_val", month_val);
    form.append("types", types);
    var xhr = new XMLHttpRequest();
    var local_host = window.location.host;          // 获取当前IP
    xhr.open('post', "/personnel/month_summary", true);
    xhr.send(form);
    xhr.onreadystatechange = function () {
        if (xhr.readyState === 4) {
            if (xhr.status === 200) {
                document.getElementById("loading").style.display = "none";
                var JsonDate = JSON.parse(xhr.responseText);
                if (types === '1') {
                    CreateDepTable(JsonDate["AttendanceObj"], JsonDate["gauge_outfit"], JsonDate["company_name"], JsonDate["create_time"], JsonDate["audit_dic"]);
                }else {
                    createDispatchTable(JsonDate["AttendanceObj"], JsonDate["gauge_outfit"], JsonDate["company_name"], JsonDate["create_time"], JsonDate["audit_dic"]);
                }
            }
        }
    };
}


function CreateDepTable(JsonDate, gauge_outfit, company_name, create_time, audit_dic) {
    if (company_name) {
        var DepartmentQuery = document.getElementById("DepartmentQuery");
        DepartmentQuery.innerHTML = "";

        var html_str1 = `
            <div style="width: 100%;height: 100%;">
                <div style="width: 100%;">
                    <table style="width: 100%;margin-bottom: 10%;">
                        <tr style="width: 100%;">
                            <th colSpan="23" style="height: 40px;width: 100%;border: #CCCCCC solid 0.5px;text-align: center;line-height: 40px;font-size: 18px;letter-spacing: 3px;border-top: none;">` + gauge_outfit + `</th>
                        </tr>
                        <tr style="width: 100%;">
                            <td colSpan="23"
                                style="height: 35px;width: 100%;border: #CCCCCC solid 0.5px;line-height: 35px;">
                                <p style="float: left;margin-left: 60px;">科 室：<span id="ReportDep">` + company_name + `</span></p>
                                <p style="float: right;margin-right: 60px;">上报时间：<span id="ReportTime">` + create_time + `</span></p>
                            </td>
                        </tr>
                        <tr>
                            <td rowSpan="2"
                                style="border: #CCCCCC solid 0.5px;width: 3%;height: 35px;line-height: 35px;text-align: center;">
                                序号
                            </td>
                            <td rowSpan="2"
                                style="border: #CCCCCC solid 0.5px;width: 10%;height: 35px;line-height: 35px;text-align: center;">
                                科室
                            </td>
                            <td rowSpan="2"
                                style="border: #CCCCCC solid 0.5px;width: 5%;height: 35px;line-height: 35px;text-align: center;">
                                工号
                            </td>
                            <td rowSpan="2"
                                style="border: #CCCCCC solid 0.5px;width: 3%;height: 35px;line-height: 35px;text-align: center;">
                                执业
                            </td>
                            <td rowSpan="2"
                                style="border: #CCCCCC solid 0.5px;width: 5%;height: 35px;line-height: 35px;text-align: center;">
                                姓名
                            </td>
                            <td rowSpan="2"
                                style="border: #CCCCCC solid 0.5px;width: 3%;height: 35px;line-height: 20px;text-align: center;">
                                实际<br>出勤<br>天数
                            </td>
                            <td colSpan="16"
                                style="border: #CCCCCC solid 0.5px;width: 56%;height: 35px;line-height: 35px;text-align: center;letter-spacing: 2cm;">
                                考勤动态
                            </td>
                            <td rowSpan="2"
                                style="border: #CCCCCC solid 0.5px;width: 15%;height: 35px;line-height: 35px;text-align: center;">
                                备注
                            </td>
                        </tr>
                        <tr>
                            <td style="border: #CCCCCC solid 0.5px;width: 3.5%;height: 35px;line-height: 35px;text-align: center;">
                                上班
                            </td>
                            <td style="border: #CCCCCC solid 0.5px;width: 3.5%;height: 35px;line-height: 35px;text-align: center;">
                                援荆
                            </td>
                            <td style="border: #CCCCCC solid 0.5px;width: 3.5%;height: 35px;line-height: 35px;text-align: center;">
                                隔离
                            </td>
                            <td style="border: #CCCCCC solid 0.5px;width: 3.5%;height: 35px;line-height: 35px;text-align: center;">
                                外差
                            </td>
                            <td style="border: #CCCCCC solid 0.5px;width: 3.5%;height: 35px;line-height: 35px;text-align: center;">
                                进修
                            </td>
                            <td style="border: #CCCCCC solid 0.5px;width: 3.5%;height: 35px;line-height: 35px;text-align: center;">
                                计生假
                            </td>
                            <td style="border: #CCCCCC solid 0.5px;width: 3.5%;height: 35px;line-height: 35px;text-align: center;">
                                产假
                            </td>
                            <td style="border: #CCCCCC solid 0.5px;width: 3.5%;height: 35px;line-height: 35px;text-align: center;">
                                年休假
                            </td>
                            <td style="border: #CCCCCC solid 0.5px;width: 3.5%;height: 35px;line-height: 35px;text-align: center;">
                                事假
                            </td>
                            <td style="border: #CCCCCC solid 0.5px;width: 3.5%;height: 35px;line-height: 35px;text-align: center;">
                                病假
                            </td>
                            <td style="border: #CCCCCC solid 0.5px;width: 3.5%;height: 35px;line-height: 35px;text-align: center;">
                                工伤
                            </td>
                            <td style="border: #CCCCCC solid 0.5px;width: 3.5%;height: 35px;line-height: 35px;text-align: center;">
                                探亲
                            </td>
                            <td style="border: #CCCCCC solid 0.5px;width: 3.5%;height: 35px;line-height: 35px;text-align: center;">
                                婚假
                            </td>
                            <td style="border: #CCCCCC solid 0.5px;width: 3.5%;height: 35px;line-height: 35px;text-align: center;">
                                丧假
                            </td>
                            <td style="border: #CCCCCC solid 0.5px;width: 3.5%;height: 35px;line-height: 35px;text-align: center;">
                                放射假
                            </td>
                            <td style="border: #CCCCCC solid 0.5px;width: 3.5%;height: 35px;line-height: 35px;text-align: center;">
                                育儿假
                            </td>
                        </tr>
                    `
        var html_str2 = ''
        for (var i = 0; i < JsonDate.length; i++) {
            var xunhuan_str = `
                        <tr style="width: 100%;">
                            <td style="border: #CCCCCC solid 0.5px;width: 3%;height: 35px;line-height: 35px;text-align: center;">` + JsonDate[i]["serial"] + `</td>
                            <td style="border: #CCCCCC solid 0.5px;width: 10%;height: 35px;line-height: 35px;text-align: center;">` + JsonDate[i]["department"] + `</td>
                            <td style="border: #CCCCCC solid 0.5px;width: 5%;height: 35px;line-height: 35px;text-align: center;">` + JsonDate[i]["job_number"] + `</td>
                            <td style="border: #CCCCCC solid 0.5px;width: 3%;height: 35px;line-height: 35px;text-align: center;">` + JsonDate[i]["practice"] + `</td>
                            <td style="border: #CCCCCC solid 0.5px;width: 5%;height: 35px;line-height: 35px;text-align: center;">` + JsonDate[i]["name"] + `</td>
                            <td style="border: #CCCCCC solid 0.5px;width: 3%;height: 35px;line-height: 20px;text-align: center;">` + JsonDate[i]["attendance_days"] + `</td>
                            <td style="border: #CCCCCC solid 0.5px;width: 3.5%;height: 35px;line-height: 35px;text-align: center;">` + JsonDate[i]["work_days"] + `</td>
                            <td style="border: #CCCCCC solid 0.5px;width: 3.5%;height: 35px;line-height: 35px;text-align: center;">` + JsonDate[i]["aid_jing"] + `</td>
                            <td style="border: #CCCCCC solid 0.5px;width: 3.5%;height: 35px;line-height: 35px;text-align: center;">` + JsonDate[i]["quarantine"] + `</td>
                            <td style="border: #CCCCCC solid 0.5px;width: 3.5%;height: 35px;line-height: 35px;text-align: center;">` + JsonDate[i]["heterodyne"] + `</td>
                            <td style="border: #CCCCCC solid 0.5px;width: 3.5%;height: 35px;line-height: 35px;text-align: center;">` + JsonDate[i]["education"] + `</td>
                            <td style="border: #CCCCCC solid 0.5px;width: 3.5%;height: 35px;line-height: 35px;text-align: center;">` + JsonDate[i]["planning"] + `</td>
                            <td style="border: #CCCCCC solid 0.5px;width: 3.5%;height: 35px;line-height: 35px;text-align: center;">` + JsonDate[i]["maternity"] + `</td>
                            <td style="border: #CCCCCC solid 0.5px;width: 3.5%;height: 35px;line-height: 35px;text-align: center;">` + JsonDate[i]["annual"] + `</td>
                            <td style="border: #CCCCCC solid 0.5px;width: 3.5%;height: 35px;line-height: 35px;text-align: center;">` + JsonDate[i]["absence"] + `</td>
                            <td style="border: #CCCCCC solid 0.5px;width: 3.5%;height: 35px;line-height: 35px;text-align: center;">` + JsonDate[i]["sick"] + `</td>
                            <td style="border: #CCCCCC solid 0.5px;width: 3.5%;height: 35px;line-height: 35px;text-align: center;">` + JsonDate[i]["industrial"] + `</td>
                            <td style="border: #CCCCCC solid 0.5px;width: 3.5%;height: 35px;line-height: 35px;text-align: center;">` + JsonDate[i]["visit"] + `</td>
                            <td style="border: #CCCCCC solid 0.5px;width: 3.5%;height: 35px;line-height: 35px;text-align: center;">` + JsonDate[i]["marriage"] + `</td>
                            <td style="border: #CCCCCC solid 0.5px;width: 3.5%;height: 35px;line-height: 35px;text-align: center;">` + JsonDate[i]["bereavement"] + `</td>
                            <td style="border: #CCCCCC solid 0.5px;width: 3.5%;height: 35px;line-height: 35px;text-align: center;">` + JsonDate[i]["vacation"] + `</td>
                            <td style="border: #CCCCCC solid 0.5px;width: 3.5%;height: 35px;line-height: 35px;text-align: center;">` + JsonDate[i]["parental_leave"] + `</td>
                            <td style="border: #CCCCCC solid 0.5px;width: 15%;height: 35px;line-height: 35px;text-align: center;">` + JsonDate[i]["notes"] + `</td>
                        </tr>
            `
            html_str2 += xunhuan_str;
        }

        var hrml_str3 = `
                    <tr>
                        <td colSpan="23"
                            style="border: #CCCCCC solid 0.5px;width: 100%;height: 50px;line-height: 50px;">
                            <p style="float: left;margin-left: 10%;">
                                <span>负责人签字：</span>
                                <span id="HeadSignature"><img src="` + audit_dic["one"]["signature_picture"] + `" alt="" style="width: 100px;height: 35px;"></span>
                            </p>
                        
                        </td>
                    </tr>
                    <tr>
                        <td colspan="23"
                            style="border: #CCCCCC solid 0.5px;width: 100%;height: 30px;line-height: 30px;padding-left: 1%;">
                            注：1、请各科室每月月底前请将考勤表纸质版由科室负责人签字后交人事科，同时将电子版发送至邓可（工号8329）3B邮箱。
                        </td>
                    </tr>
                    <tr>
                        <td colspan="23"
                            style="border: #CCCCCC solid 0.5px;width: 100%;height: 30px;line-height: 30px;padding-left: 1%;">
                            &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;2、请按科室人员实际上班情况填报，工号一定要准确。
                        </td>
                    </tr>
                    <tr>
                        <td colspan="23"
                            style="border: #CCCCCC solid 0.5px;width: 100%;height: 30px;line-height: 30px;padding-left: 1%;">
                            &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;3、上报时人员名单顺序尽量与上月保持一致，增加的人员分别排在最后（医、护分开）。
                        </td>
                    </tr>
                </table>
            </div>
        </div>
        `

        var all_str = html_str1 + html_str2 + hrml_str3;
        $("#DepartmentQuery").append(all_str);
    }
}

function createDispatchTable(JsonDate, gauge_outfit, company_name, create_time, audit_dic) {
    if (company_name) {
        var LaborDispatch = document.getElementById("LaborDispatch");
        LaborDispatch.innerHTML = "";

        var html_str1 = `
            <div style="width: 100%;height: 100%;">
                    <div style="width: 100%;">
                        <table style="width: 100%;margin-bottom: 10%;">
                            <tr style="width: 100%;">
                                <th colspan="10" style="height: 40px;width: 100%;border: #CCCCCC solid 0.5px;text-align: center;line-height: 40px;font-size: 18px;letter-spacing: 3px;border-top: none;">`+gauge_outfit+`</th>
                            </tr>
                            <tr style="width: 100%;">
                                <td colspan="10" style="height: 35px;width: 100%;border: #CCCCCC solid 0.5px;line-height: 35px;">
                                    <p style="float: left;margin-left: 60px;width: 400px;">科 室：`+company_name+`</p>
                                    <p style="display: inline-block;vertical-align: top;">
                                        负责人签字：<img src="`+audit_dic["one"]["signature_picture"]+`" alt="" style="width: 100px;height: 35px;">
                                    </p>
                                    <p style="float: right;margin-right: 60px;">上报时间：`+create_time+`</p>
                                </td>
                            </tr>
                            <tr>
                                <td style="border: #CCCCCC solid 0.5px;width: 5%;height: 35px;line-height: 35px;text-align: center;">
                                    序号
                                </td>
                                <td style="border: #CCCCCC solid 0.5px;width: 15%;height: 35px;line-height: 35px;text-align: center;">
                                    <div class="oline"> <span class="span1">考核项目</span> <span class="span2">姓 名</span> </div>
                                </td>
                                <td style="border: #CCCCCC solid 0.5px;width: 10%;height: 35px;line-height: 35px;text-align: center;">
                                    实际出勤天数
                                </td>
                                <td style="border: #CCCCCC solid 0.5px;width: 10%;height: 35px;line-height: 35px;text-align: center;">
                                    请假类别及天数
                                </td>
                                <td style="border: #CCCCCC solid 0.5px;width: 10%;height: 35px;line-height: 35px;text-align: center;">
                                    劳动纪律（20分）
                                </td>
                                <td style="border: #CCCCCC solid 0.5px;width: 10%;height: 35px;line-height: 35px;text-align: center;">
                                    工作质量（30分）
                                </td>
                                <td style="border: #CCCCCC solid 0.5px;width: 10%;height: 35px;line-height: 35px;text-align: center;">
                                    工作能力（30分）
                                </td>
                                <td style="border: #CCCCCC solid 0.5px;width: 10%;height: 35px;line-height: 35px;text-align: center;">
                                    其他（20分）
                                </td>
                                <td style="border: #CCCCCC solid 0.5px;width: 10%;height: 35px;line-height: 35px;text-align: center;">
                                    总得分
                                </td>
                                <td style="border: #CCCCCC solid 0.5px;width: 10%;height: 35px;line-height: 35px;text-align: center;">
                                    备注
                                </td>
                            </tr>
                    `
        var html_str2 = ''
        for (var i = 0; i < JsonDate.length; i++) {
            var xunhuan_str = `
                        <tr>
                            <td style="border: #CCCCCC solid 0.5px;width: 5%;height: 35px;line-height: 35px;text-align: center;">
                                `+JsonDate[i]["serial"]+`
                            </td>
                            <td style="border: #CCCCCC solid 0.5px;width: 15%;height: 35px;line-height: 35px;text-align: center;">
                                `+JsonDate[i]["project_name"]+`
                            </td>
                            <td style="border: #CCCCCC solid 0.5px;width: 10%;height: 35px;line-height: 35px;text-align: center;">
                                `+JsonDate[i]["attendance_days"]+`
                            </td>
                            <td style="border: #CCCCCC solid 0.5px;width: 10%;height: 35px;line-height: 35px;text-align: center;">
                                `+JsonDate[i]["leave_type"]+`
                            </td>
                            <td style="border: #CCCCCC solid 0.5px;width: 10%;height: 35px;line-height: 35px;text-align: center;">
                                `+JsonDate[i]["labor_discipline"]+`
                            </td>
                            <td style="border: #CCCCCC solid 0.5px;width: 10%;height: 35px;line-height: 35px;text-align: center;">
                                `+JsonDate[i]["work_quality"]+`
                            </td>
                            <td style="border: #CCCCCC solid 0.5px;width: 10%;height: 35px;line-height: 35px;text-align: center;">
                                `+JsonDate[i]["working_ability"]+`
                            </td>
                            <td style="border: #CCCCCC solid 0.5px;width: 10%;height: 35px;line-height: 35px;text-align: center;">
                                `+JsonDate[i]["other"]+`
                            </td>
                            <td style="border: #CCCCCC solid 0.5px;width: 10%;height: 35px;line-height: 35px;text-align: center;">
                                `+JsonDate[i]["total_score"]+`
                            </td>
                            <td style="border: #CCCCCC solid 0.5px;width: 10%;height: 35px;line-height: 35px;text-align: center;">
                                `+JsonDate[i]["notes"]+`
                            </td>
                        </tr>
            `
            html_str2 += xunhuan_str;
        }

        var hrml_str3 = `
                </table>
            </div>
        </div>
        `

        var all_str = html_str1 + html_str2 + hrml_str3;
        $("#LaborDispatch").append(all_str);
    }
}